Use case: SMARTCARD RX IT process ¶
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
#define DATA_TO_RECEIVE_SIZE 256
uint8_t aRxBuffer[DATA_TO_RECEIVE_SIZE];
SMARTCARD_HandleTypeDef hsmartcard;
/* Ensure that all required peripherals
(USART, GPIO, NVIC etc.) are configured properly
/*
...
*/
/* Smartcard register Receive complete user callback */
HAL_SMARTCARD_RegisterCallback(&hsmartcard, HAL_SMARTCARD_RX_CB_ID,
Smartcard_RxCpltCallback);
/* Start a Smartcard Process in interruption mode */
HAL_SMARTCARD_Receive_IT(&hsmartcard, aRxBuffer,
DATA_TO_RECEIVE_SIZE);
|
#define DATA_TO_RECEIVE_SIZE 256
uint8_t aRxBuffer[DATA_TO_RECEIVE_SIZE];
hal_smartcard_handle_t hsmartcard;
/* Ensure that all required peripherals
(USART, GPIO, NVIC etc.) are configured properly
/*
...
*/
/* Smartcard register Receive complete user callback */
HAL_SMARTCARD_RegisterRxCpltCallback(&hsmartcard, Smartcard_RxCpltCallback);
/* Start a Smartcard Process in interruption mode */
HAL_SMARTCARD_Receive_IT(&hsmartcard, aRxBuffer,
DATA_TO_RECEIVE_SIZE);
|
Key changes ¶
HAL2 uses the SMARTCARD handle type hal_smartcard_handle_t.
HAL2 provides a dedicated receive-complete callback registration API (HAL_SMARTCARD_RegisterRxCpltCallback).

